package cn.mw.cmdb.processor;

import cn.mw.cmdb.entity.ClassificationMenuVo;
import cn.mw.microMonitorCommon.api.cmdb.TableIdEnum;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class DefaultTreeOptionProccessor implements TreeOptionProccessor {
    @Override
    public Object genTreeOption() throws Exception {
        List<ClassificationMenuVo> menuVoList = new ArrayList<>();
        List<TableIdEnum> list = Arrays.stream(TableIdEnum.values()).filter(TableIdEnum::isShowInDropDown).toList();
        if (!CollectionUtils.isEmpty(list)) {
            list.forEach(item -> {
                menuVoList.add(ClassificationMenuVo.builder().code(item.getCode()).label(item.getName()).isCustom(false).build());
            });
        }
        return menuVoList;
    }
}
